1. Field of the Invention
Embodiments of the present invention generally relate to memory systems. More particularly, embodiments of the present invention relate to the field of controlling access to the content of a memory.
2. Related Art
The growing trend towards networked computers, computers having multiple CPUs (central processing unit), and multi-threaded software poses a number of challenges for memory systems. In particular, the memory systems need to respond to access requests (e.g., to read data, to write data, etc.) from various data users (e.g., computer1, computer2, CPU1, CPU2, software1, software2, etc.) for shared resources while maintaining coherency so that the multiple data users have a similar view of the content in the memory system. Several approaches have been implemented.
In one case, when implementing concurrent multi-threaded software, mutually exclusive access to certain data structures in the memory system is often needed in order to guarantee coherence and to avoid corrupting the data structures. Such mutual exclusion is traditionally implemented using semaphores, which are software flags that a thread may set to indicate that it needs exclusive access to the associated data structure. Other threads are expected to properly inspect and honor the semaphore (i.e., not try to access the data structure when the flag is already set.)
This works well when the software is behaved, but problems arise when the software has design defects or is not operating properly. If the software has design defects, one thread may end up monopolizing a particular semaphore forever, preventing others from accessing the associated data structure forever. Moreover, if the software has design defects or undetected bugs (or operates in a faulty manner), a thread may choose to not honor the semaphore and to proceed to access a data structure whose flag is already set by another thread. This may lead to data coherency problems.
Similarly, in an architecture having multiple CPUs or computers (each having one or more CPUs), there is a need for mutually exclusive access to particular data of the content in the memory system. Such mutual exclusion is generally implemented using a lock process. The lock process enables a CPU to obtain a lock on the particular data in the memory system so as to prevent other CPUs from having access to the particular data until the lock is released by the CPU holding it. Typically, any other CPU that needs to access the particular data waits until the lock is released or communicates with the CPU holding the lock to request the release of the lock.
In this case, the lock process is suitable if the CPUs are functioning properly. Generally, the memory lock process fails to prevent a misbehaving CPU from accessing content of a memory system due to a design defect or undetected bugs (or operates in a faulty manner) or a hardware malfunction in the CPU. Moreover, the lock process does not prevent a CPU from monopolizing a lock to the detriment of other CPUs.
In sum, these approaches are less than satisfactory in many instances because broken/overloaded CPUs or defective software are able to corrupt content (in the memory system) belonging to another CPU or software through a lock or a semaphore and also to monopolize content (in the memory system) forever after securing a lock or a semaphore, complicating error recovery.